<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p{
            margin: 0;
        }
        .box {
            width: 200px;
            height: 200px;
            border: 2px solid red;
            position: relative;
            overflow: hidden;
        }
        .box img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .box p {
            width: 100%;
            height: 40px;
            background-color: rgba(0, 0, 0, 0.5);
            text-align: center;
            color: #fff;
            line-height: 40px;
            position: absolute;
            left: 0;
            bottom: -40px; /* 初始状态，隐藏在盒子外 */
            transition: bottom 1s ease;

            /* 最终的状态 */
            /* bottom: 0; */
        }
        .box:hover p {
            bottom: 0; /* 鼠标悬停时，文字上移显示 */
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="./assets/head3.jpg" alt="">
        <p>上帝散落的光</p>
    </div>
</body>
</html>